package com.example.tcpmaster.callback;

import android.content.Context;
import android.view.ViewGroup;

import com.example.tcpmaster.SocketListener;
import com.example.tcpmaster.interfaces.OnTcpActionCallBackStateListener;
import com.example.tcpmaster.interfaces.OnTcpUICallBackStateListener;

/**
 * Created by lianxiang on 2017/9/6.
 * TCP 业务操作，单独解耦。
 */

public abstract  class AbsTcpActionCallBack implements OnTcpActionCallBackStateListener {
    protected Context mContext;
    protected SocketListener socketListener;


    public AbsTcpActionCallBack(Context context) {
        this.mContext = context;
    }

    protected abstract  void init(Context context);


    public void setSocketListener(SocketListener socketListener) {
        this.socketListener = socketListener;
    }

    @Override
    public void onReceive(String s) {
        if (socketListener != null){
            socketListener.onResult(0,"一包数据",s);
        }
    }
}
